package cn.tomoki.demo01.controller;

import cn.tomoki.demo01.entity.OutUser;
import cn.tomoki.demo01.service.OutUserServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class OutUserController {

    @Autowired
    private OutUserServiceImpl outUserService;
    ObjectMapper mapper = new ObjectMapper();

//    @GetMapping("/get")
//    @PostMapping("/get")
    @RequestMapping("/get")
    @ResponseBody
    public String getOutUser(@RequestParam int outUserId) throws JsonProcessingException {
        OutUser outUser = outUserService.getOutUserById(outUserId);
        String str = mapper.writeValueAsString(outUser);
        return str;
    }
}
